{extend name="layout" /}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="block">
            {notempty name="tab_nav"}
            <ul class="nav nav-tabs">
                {volist name="tab_nav['tab_list']" id="tab"}
                <li name="tab_nav.curr_tab" value="$key" { {eq }class="active"
                /eq}>
                <a href="{$tab.url}">{$tab.title}</a>
                </li>
                {/volist}
                <li class="pull-right">
                    <ul class="block-options push-10-t push-10-r">
                        <li>
                            <a href="{:url('index', ['type' => $type])}"><i class="si si-{$type=='list' ? 'list' : 'grid'}"></i></a>
                        </li>
                        <li>
                            <button data-action="fullscreen_toggle" data-toggle="block-option" type="button"></button>
                        </li>
                    </ul>
                </li>
            </ul>
            {else/}
            <div class="block-header bg-gray-lighter">
                <ul class="block-options">
                    <li>
                        <button data-action="fullscreen_toggle" data-toggle="block-option" type="button"></button>
                    </li>
                    <li>
                        <button data-action="refresh_toggle" data-action-mode="demo" data-toggle="block-option" type="button"><i class="si si-refresh"></i>
                        </button>
                    </li>
                    <li>
                        <button data-action="content_toggle" data-toggle="block-option" type="button"></button>
                    </li>
                    <li>
                        <button data-action="close" data-toggle="block-option" type="button"><i class="si si-close"></i></button>
                    </li>
                </ul>
                <h3 class="block-title">{$page_title}</h3>
            </div>
            {/notempty}
            <div class="block-content tab-content">
                <div class="tab-pane active">
                    <div class="row push-20">
                        <div class="col-md-12">
                            <div class="pull-right search-bar">
                                <form class="input-group">
                                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                                    <input class="form-control" name="keyword" placeholder="请输入标识/名称/作者" type="text" value="{:input('get.keyword')}">
                                </form>
                            </div>

                            <div class="toolbar-btn-action">
                                <a class="btn btn-default" href="{:url('index')}" title="全部">全部({$total.all|default='0'})</a>
                                <a class="btn btn-success" href="{:url('index', ['status' => '1'])}" title="已启用">已启用({$total['1']|default='0'})</a>
                                <a class="btn btn-warning" href="{:url('index', ['status' => '0'])}" title="已禁用">已禁用({$total['0']|default='0'})</a>
                                <a class="btn btn-info" href="{:url('index', ['status' => '-1'])}" title="未安装">未安装({$total['-1']|default='0'})</a>
                                <a class="btn btn-danger" href="{:url('index', ['status' => '-2'])}" id="hide_disable" title="已损坏">已损坏({$total['-2']|default='0'})</a>
                            </div>
                        </div>
                    </div>
                    <div class="row module-list push-20">
                        {empty name="modules"}
                        <div class="table-empty">
                            <div class="text-center empty-info">
                                <i class="fa fa-database"></i> 暂无数据<br>
                            </div>
                        </div>
                        {/empty}
                        {eq name="type" value="block"}
                        {volist name="modules" id="module"}
                        <div class="col-sm-6 col-md-4 col-lg-3">
                            <div class="block block-rounded">
                                <div class="block-content block-content-full text-center bg-{$module.bg_color|default='danger'} ribbon ribbon-bookmark ribbon-crystal">
                                    <div class="ribbon-box font-w600">{$module.version|default='无版本号'}</div>
                                    <div class="item item-2x item-circle bg-crystal-op push-20-t push-20 visibility-hidden" data-class="animated fadeIn"
                                         data-offset="50" data-toggle="appear">
                                        <i class="{$module.icon|default='fa fa-puzzle-piece'} text-white-op"></i>
                                    </div>
                                    <h3 class="h4 text-white">{$module.title|default='无模块标题'}</h3>
                                    <div class="text-white-op">
                                        <em>{$module.name|default=''}</em>
                                    </div>
                                </div>
                                <div class="block-content bg-gray-lighter">
                                    <div class="{$module.status_class} pull-right push-10-l">{$module.status_info|raw}</div>
                                    <div class="push-10">
                                        <a class="h5" href="{$module.author_url|default=''}" target="_blank"><i class="fa fa-user"></i>
                                            {$module.author|default=''}</a>
                                    </div>
                                    <div class="push-10 mheight-100">
                                        <div data-height="110px" data-toggle="slimscroll">
                                            <p class="text-gray-dark">{$module.description|raw|default='暂无简介'}</p>
                                        </div>
                                    </div>
                                    <div class="text-center push">
                                        {$module.actions|raw}
                                    </div>
                                </div>
                            </div>
                        </div>
                        {/volist}
                        {else/}
                        {notempty name="modules"}
                        <div class="col-md-12">
                            <div class="builder-table-wrapper" id="builder-table-wrapper">
                                <div class="builder-table" id="builder-table">
                                    <table class="table table-builder table-hover table-bordered table-striped">
                                        <thead>
                                        <tr>
                                            <th>名称</th>
                                            <th>图标</th>
                                            <th>版本</th>
                                            <th>作者</th>
                                            <th>简介</th>
                                            <th class="column-right_button">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {volist name="modules" id="module"}
                                        <tr>
                                            <td>{$module.title|default='无模块标题'}</td>
                                            <td><i class="{$module.icon|default='fa fa-puzzle-piece'}"></i></td>
                                            <td>{$module.version|default='无版本号'}</td>
                                            <td><a href="{$module.author_url|default=''}" target="_blank">{$module.author|default=''}</a></td>
                                            <td>{$module.description|raw|default='暂无简介'}</td>
                                            <td>{$module.actions|raw}</td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        {/notempty}
                        {/eq}
                    </div>
                    <div class="data-table-toolbar">
                        <div class="row">
                            <div class="col-sm-12">
                                {// 分页 }
                                {notempty name="pages"}
                                {$pages}
                                {/notempty}
                                {notempty name="row_list"}
                                <div class="pagination-info pull-right">
                                    <form action="" method="get">
                                        <input class="form-control input-sm go-page" name="page" type="text" value="{:input('param.page', '1')}">
                                        <input class="form-control input-sm nums" name="list_rows" type="text"
                                               value="{php}echo input('param.list_rows', '') == '' ? config('list_rows') : input('param.list_rows');{/php}">
                                        <input class="hidden" type="submit">
                                        / <strong>{$row_list->lastPage()}</strong> 页，共 <strong>{$row_list->total()}</strong> 条数据，每页显示数量
                                    </form>
                                </div>
                                {/notempty}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}